<template>
	<view class="main">
		<view class="header">
			分账提示:
			<view class="header-tips">分账商户必须在同个渠道</view>
		</view>
		<view class="content">
			<view class="card-line">
				<view class="card" @click="navigateTo('/pages-automatic-ledger/automatic-ledger/ledger-account')">
					<view class="top">
						<view class="top-title">
							分账商户
						</view>
						<view class="top-icon">
							<image class="icon" :src="`${baseStaticFileUrl}/image/auctomatic-ledger/icon1.svg`" />
						</view>
					</view>
					<view class="bottom">
						<view class="bottom-title">
							共{{count}}人
						</view>
						<view class="bottom-icon">
							<image class="toIcon" :src="`${baseStaticFileUrl}/image/auctomatic-ledger/toIcon.svg`" />
						</view>
					</view>
				</view>
				<view class="card" @click="navigateTo('/pages-automatic-ledger/automatic-ledger/ledger-proportion')">
					<view class="top">
						<view class="top-title">
							分账比例
						</view>
						<view class="top-icon">
							<image class="icon" :src="`${baseStaticFileUrl}/image/auctomatic-ledger/icon2.svg`" />
						</view>
					</view>
					<view class="bottom">
						<view class="bottom-title">
						</view>
						<view class="bottom-icon">
							<image class="toIcon" :src="`${baseStaticFileUrl}/image/auctomatic-ledger/toIcon.svg`" />
						</view>
					</view>
				</view>
			</view>
			<view class="card-line"  @click="navigateTo('/pages-automatic-ledger/automatic-ledger/profit-profit/profit-profit')">
				<view class="card">
					<view class="top">
						<view class="top-title">
							分账收益
						</view>
						<view class="top-icon">
							<image class="icon" :src="`${baseStaticFileUrl}/image/auctomatic-ledger/icon3.svg`" />
						</view>
					</view>
					<view class="bottom">
						<view class="bottom-title">
							收益统计
						</view>
						<view class="bottom-icon">
							<image class="toIcon" :src="`${baseStaticFileUrl}/image/auctomatic-ledger/toIcon.svg`" />
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseStaticFileUrl: this.$configPath.staticFileUrl,
				count: 0,
				qualificationTypeEnum: this.$qualificationTypeEnum,
			}
		},
		onLoad() {
			this.findSubLedgerMerchantCountByUserId()
		},
		methods: {
			navigateTo(url) {
				uni.navigateTo({
					url: url
				});
			},
			findSubLedgerMerchantCountByUserId() {
				this.$api('qualification.findSubLedgerMerchantCountByUserId', {type:this.qualificationTypeEnum.COOPERATION_QUALIFICATION}).then(res => {
					if (res.status == 0) {
						this.count = res.data.count
					} else {
						getApp().err("查询失败" + res.msg)
					}
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	.main {
		.header {
			font-size: $f-sm;
			background-color: white;
			padding: 30rpx;
			color: rgba(0, 0, 0, 0.85);

			.header-tips {
				margin-top: 35rpx;
				margin-left: 20rpx;
			}
		}

		.content {
			margin-top: 20rpx;
			background-color: white;
			padding: 30rpx;

			.card-line {
				display: flex;
				justify-content: space-between;
			}

			.card {
				border-radius: 20px;
				width: 140px;
				height: 80px;
				padding: 28rpx 24rpx;
				margin: 15rpx;

				background-color: rgb(248, 248, 248);
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.top {
					display: flex;
					justify-content: space-between;

					.top-title {
						font-size: $f-lg - 2;
						font-weight: bold;
					}

					.icon {
						width: 80rpx;
						height: 80rpx;
					}

				}

				.bottom {
					display: flex;
					justify-content: space-between;

					.bottom-title {
						font-size: $f-base;
						color: rgba(0, 0, 0, 0.7);
					}

					.toIcon {
						width: 48rpx;
						height: 32rpx;
					}
				}
			}
		}
	}
</style>
